<?php
$this->breadcrumbs=array(
	'Users'=>array('index'),
	$model->id,
);

$this->menu=array(
	array('label'=>'List User', 'url'=>array('index')),
	array('label'=>'Create User', 'url'=>array('create')),
	array('label'=>'Update User', 'url'=>array('update', 'id'=>$model->id)),
	array('label'=>'Delete User', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
    array('label'=>'Update User Password', 'url'=>array('updatepassword', 'id'=>$model->id)),
);
?>

<h1>View User #<?php echo $model->id; ?></h1>

<?php $this->widget('zii.widgets.CDetailView', array(
	'data'=>$model,
	'attributes'=>array(
		'id',
		'email',
		'fullname',
		'first_name',
		'last_name',
        'original_password',
		'ctime',
		'mtime',
	),
)); ?>

<?php $courseIds = $model->getCourseIds();?>
<table>
    <caption>Courses</caption>
    <thead>
        <tr style="background-color: #999999; color:#ffffff; font-weight: bold">
            <td>NAME</td>
            <td>COURSE ID</td>
            <td>POSITION</td>
        </tr>
    </thead>
    <tbody>
    <?php if( ! empty($courseIds)):?>
        <?php foreach($courseIds as $courseId):?>
            <?php $c = Course::model()->getById($courseId);?>
            <?php if($c instanceof Course):?>
            <tr>
                <td><?php echo $c->name;?></td>
                <td><?php echo $c->course_id;?></td>
                <td><?php echo $c->getMemberPosition($model->getId());?></td>
            </tr>
            <?php endif;?>
        <?php endforeach;?>
    <?php else:?>
        <tr>
            <td></td>
            <td></td>
            <td></td>
        </tr>
    <?php endif;?>
    </tbody>
</table>


<?php $conexusIds = $model->getConexusIds();?>
<table>
    <caption>Conexus</caption>
    <thead>
        <tr style="background-color: #999999; color:#ffffff; font-weight: bold">
            <td>NAME</td>
            <td>CONEXUS ID</td>
            <td>POSITION</td>
        </tr>
    </thead>
    <tbody>
    <?php if( ! empty($conexusIds)):?>
        <?php foreach($conexusIds as $conexusId):?>
            <?php $c = Conexus::model()->getById($conexusId);?>
            <?php if($c instanceof Conexus):?>
            <tr>
                <td><?php echo $c->name;?></td>
                <td><?php echo $c->conexus_id;?></td>
                <td><?php echo $c->getMemberPosition($model->getId());?></td>
            </tr>
            <?php endif;?>
        <?php endforeach;?>
    <?php else:?>
        <tr>
            <td></td>
            <td></td>
            <td></td>
        </tr>
    <?php endif;?>
    </tbody>
</table>